﻿using System.Web.Mvc;

namespace HelloWorld.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index(string id)
        {
            ViewData["Message"] = "This is a string created in the controller";
            ViewBag.Id = id;
            return View();
        }

        [HttpGet]
        public ActionResult ContactUs()
        {
            return View(new Code.DataAccess.Message());
        }

        [HttpPost]
        public ActionResult ContactUs(Code.DataAccess.Message message)
        {
            string saveResultMessage;
            ViewBag.SaveResult = message.Save(out saveResultMessage);
            ViewBag.SaveResultMessage = saveResultMessage;
            return View(message);
        }
    }
}
